// run: $exec < input
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <iomanip>

int const maxn = 200007;
int psum[maxn], lsum[maxn];
int n, k;
long long x;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> k >> x;
	std::vector<long long> v;
	v.resize(n);
	for (int i = 0; i < n; i++) std::cin >> v[i];
	std::sort(v.begin(), v.end(), std::greater<int>());
	long long now = 0;
	for (int i = 0; i < n; i++) now |= v[i];
	psum[0] = v[0];
	for (int i = 1; i < n; i++) psum[i] = psum[i - 1] | v[i];
	lsum[n - 1] = v[n - 1];
	for (int i = n - 2; i >= 0; i--) lsum[i] = lsum[i + 1] | v[i];
	for (int j = 0; j < k; j++) {
		long long max = now, p = -1;
		for (int i = 0; i < n; i++) {
			long long tmp = (v[i] * x) | lsum[i + 1];
			if (i) tmp = psum[i - 1] | (v[i] * x) | lsum[i + 1];
			if (tmp > max) {
				max = tmp;
				p = i;
			}
		}
		now = max;
		v[p] *= x;
		psum[0] = v[0];
		for (int i = 1; i < n; i++) psum[i] = psum[i - 1] | v[i];
		lsum[n - 1] = v[n - 1];
		for (int i = n - 2; i >= 0; i--) lsum[i] = lsum[i + 1] | v[i];
	}
	std::cout << now << "\n";
}

